package com.example.mybatis.mapper;


import com.example.mybatis.model.ArticleInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleInfoMapper {
    @Select("select * from articleinfo")
    List<ArticleInfo> selectAll();

    /**
     * 根据文章id 获取文章信息和用户名字
     * @return
     */
    @Select("select da.*, du.age, du.username from articleinfo as da,userinfo as du where da.id = #{id} and da.uid = du.id")
    ArticleInfo selectArticleInfoAndUserById(Integer articleid);

}
